{% extends "base.html" %}

{% block title %}
  Contest List
{% endblock %}

{% block body %}

{% for contest in contests %}
<div class="contest">
  <h1>{{contest.name}} {% if contest.IsCompleted %}<span class="completed">(completed)</span>{% endif %}</h1>
  <a href="/contest/{{contest.key.id}}">
    <img src="/contestimage/{{contest.image.key.id}}" class="captionImage"/>
  </a>
  <div>
    <span class="submissionDeadline">
      {% if contest.IsCompleted %}
      <b>Contest completed</b>
      {% else %}
      Contest ends {{contest.end_time|DisplayDate}}
      {% endif %}
    </span>
  </div>
  {% if contest.description %}
  <div class="explanation">
    {{contest.description}}
  </div>
  {% endif %}
</div>
{% endfor %}

{% if next or previous %}
  <div>
    {% if previous %}
    <a href="?page={{page|add:-1}}">Previous page</a>
    {% endif %}
    {% if next %}
    <a href="?page={{page|add:1}}">Next page</a>
    {% endif %}
  </div>
{% endif %}
{% endblock %}
